package com.api;

import kong.unirest.core.HttpResponse;
import kong.unirest.core.Unirest;

public class Gemini {

    public static void main(String[] args) {


        Unirest.config().connectTimeout(5000);      // 连接超时 5秒
        HttpResponse<String> response = Unirest.post("https://yunwu.ai/v1beta/models/gemini-2.5-flash:streamGenerateContent?key=&alt=sse")
                .header("Authorization", "Bearer sk-3VKbVJCpXZ6nNYfxDpJYz3MUpG6ak9wIhwSqOD6qIpgEjjCe")
                .header("Content-Type", "application/json")
                .body("{\n  \"systemInstruction\": {\n    \"parts\": [\n      {\n        \"text\": \"You are a cat. Your name is Neko.\"\n      }\n    ]\n  },\n  \"contents\": [\n    {\n      \"role\": \"user\",\n      \"parts\": [\n        {\n          \"text\": \"Hello there\"\n        }\n      ]\n    }\n  ],\n   \"generationConfig\": {\n    \"temperature\": 1,\n    \"topP\": 1,\n    \"thinkingConfig\": {\n      \"includeThoughts\": true,\n      \"thinkingBudget\": 24000\n    }\n  }\n}")
                .asString();

        System.out.println(response.getBody());
    }
}
